<template>
  <div>
    <el-card class="box-card" shadow="never">
      <div slot="header" class="clearfix">
        <span> 😊 每日一句</span>
      </div>
      <div class="has-text-left block">
        <span v-text="tip.content">整日都很无聊的阿呆想睡觉</span>
      </div>
      <div class="has-text-right mt-5 block">
          <span v-text="tip.author">——阿呆</span>
      </div>
    </el-card>
  </div>
</template>
<script>
import { getTipToday } from '../../api/tip'
export default {
    name:"Tip",
    data() {
        return {
            tip:{
                content:"",
                author:"",
            },
        }
    },
    created(){
        this.fetchTip();
    },
    methods:{
        fetchTip(){
            getTipToday().then(res=>{
                const result = res.data;
                if(result.code == 0){
                    this.tip = result.data;
                }else{
                    this.$message({
                        message: "获取每日名言失败",
                        type: "warning",
                    })
                }
            })
        }
    }
};
</script>

<style scoped>

</style>